/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:龙宝
 * Date:2023-11-13
 * Time:11:47
 */
class MyThead implements Runnable{

    @Override
    public void run() {
        while (true) {
            System.out.println("线程2");
        }
    }
}
public class Thread2 {
    public static void main(String[] args) throws InterruptedException {
        MyThread t = new MyThread();
        t.start();
        int i = 0;
        while (i<50) {
            System.out.println("主线程");
            Thread.sleep(1000);
            i++;
        }
    }
}
